﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<string>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>AddUserInfo</title>
    <script src="<%=Url.Content(kysec.CR.MyUrl.WebData.WEBURL + "/Scripts/jquery-1.4.1.min.js") %>" type="text/javascript"></script>   
    <script type="text/javascript">
        $(function () {
            $("#userEixt").hide();
            $("#right").hide();
        });
        function validate() {
            if ($("#c_vc_password").val() == $("#rePassword").val()) {
                return true;
            } else {
                alert("两次输入密码不一致！");
                $("#c_vc_password").val(' ');
                $("#rePassword").val(' ');
            }
        }
        function submitForm() {
            if (validate()) {
                $.ajax({
                    type: 'post',
                    cache: 'false',
                    url: '/User/AddUserInfo',
                    data: 'c_vc_userName=' + $("#c_vc_userName").val() + "&c_vc_passWord=" + $("#c_vc_password").val() + '&c_i_pop=' + $("[name=c_i_pop]:checked").val(),
                    success: function (result) {
                        if (result == '1') {
                            alert("添加成功");
                            window.location.href = "/User/InfoList";
                        } else if (result == '0') {
                            alert("添加失败!");
                        }
                    }
                });
            }
        }

        function getUser() {
            if ($("#c_vc_userName").val() == ' ') {
                return false;
            } else {           
                $.ajax({
                    type: 'post',
                    cache: 'false',
                    url:'/User/getUser',
                    data: 'username=' + $("#c_vc_userName").val(),
                    success: function (result) {
                        if (result == true) {
                            $("#user").hide();
                            $("#right").hide();
                            $("#userEixt").show();
                            $("#c_vc_userName").val('');
                            $("#c_vc_userName").focus();
                        }
                        else if (result == false) {
                            $("#user").hide();
                            $("#userEixt").hide();
                            $("#right").show();
                        }
                    }
                });
            }
        }
        function resetForm() {
            $("#c_vc_username").val(' ');
            $("#c_vc_password").val(' ');
            $("#c_i_pop").val(' ');
            $("#rePassword").val(' ');
        }
    </script>
    <link href="../../Content/back/css/op.css" rel="stylesheet" type="text/css" />
    <link href="../../Content/back/css/skin.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div>
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="17" height="29" valign="top" background="<%=Url.Content(kysec.CR.MyUrl.WebData.WEBURL + "/Content/back/images/mail_leftbg.gif") %>"><img src="<%=Url.Content

(kysec.CR.MyUrl.WebData.WEBURL + "/Content/back/images/left-top-right.gif") %>" width="17" height="29" /></td>
    <td width="100%" height="29" valign="top" background="<%=Url.Content(kysec.CR.MyUrl.WebData.WEBURL + "/Content/back/images/content-bg.gif") %>"><table width="100%" 

height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2">
      <tr>
        <td height="31"><div class="titlebt">添加用户</div></td>
      </tr>
    </table></td>
    <td width="16" valign="top" background="<%=Url.Content(kysec.CR.MyUrl.WebData.WEBURL + "/Content/back/images/mail_rightbg.gif") %>"><img src="<%=Url.Content

(kysec.CR.MyUrl.WebData.WEBURL + "/Content/back/images/nav-right-bg.gif") %>" width="16" height="29" /></td>
  </tr>

  <tr>
    <td height="71" valign="middle" background="<%=Url.Content(kysec.CR.MyUrl.WebData.WEBURL + "/Content/back/images/mail_leftbg.gif") %>">&nbsp;</td>
    <td valign="top" bgcolor="#F7F8F9"><table border="0" cellpadding="0" cellspacing="0"> 
     <tr>
            <td class="left_txt">当前位置：<a href="/User/InfoList">用户管理</a> >> 添加用户</td>
      </tr></table>
   <div style="background-color:#97b9f0;height:1px;margin-bottom:10px;"></div>

        <div style="text-align:center;">

           <div style="margin-top:10px; " >
            <table border="0" cellpadding="1" cellspacing="0" width="100%" >
            <tr  style="height:50px;" bgcolor="#d3ebf8">
                <td width="10%" ><div><label>用&nbsp;户&nbsp;名</label></div></td>
                <td width="30%" align="left"><div class="td_Left"><input type="text" id="c_vc_userName" name="c_vc_userName" size="20" onblur="getUser();"/></div></td>
                <td align="left"><div class="error" id="user">用户号必须使用字母和数字</div><div id="right">该用户号可以注册使用</div><div id="userEixt">该用户已存在</div></td>
            </tr>
            
            <tr style="height:50px;" bgcolor="#97b9f0">
                <td width="10%"><div><label>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码</label></div> </td>
                <td width="30%" align="left"><div class="td_Left"><input type="password" id="c_vc_password" name="c_vc_password" size="22" /></div></td>
                <td align="left"><div class="error">密码长度必须大于等于6位</div></td>
            </tr>
           
            <tr style="height:50px;" bgcolor="#d3ebf8">
                <td  width="10%"><div><label>确认密码</label></div> </td>
                <td  width="30%" align="left"><div class="td_Left"><input type="password" id="rePassword"  name="rePassword" size="22" /></div></td>
                <td  align="left"><div class="error">请再次输入密码</div></td>
            </tr>
            
            <tr style="height:50px;"  bgcolor="#97b9f0">
                <td><div><label>权&nbsp;&nbsp;&nbsp;&nbsp;限</label></div></td>
                <td align="left" colspan="2"><div class="td_Left"><input type="radio" name="c_i_pop" value="0" />高级权限&nbsp;<input type="radio" name="c_i_pop" value="1" 

checked="checked"/>初级权限</div></td>
            </tr>
            
            </table></div>
            <div style="min-height:1px; width:100%; background-color:#d3ebf8;">&nbsp;</div>
            <p>
                <a href="javascript:;" onclick="submitForm();">确认添加</a>
                <a href="javascript:;" onclick="resetForm();" style="margin:0px 20px 0px 20px;">重置</a>
                <a href="<%=kysec.CR.MyUrl.WebData.WEBURL %>/User/InfoList">返回</a>
            </p>
        </div>
     </td>
    <td background="<%=Url.Content(kysec.CR.MyUrl.WebData.WEBURL + "/Content/back/images/mail_rightbg.gif") %>">&nbsp;</td>
  </tr>
  <tr>
    <td valign="middle" background="<%=Url.Content(kysec.CR.MyUrl.WebData.WEBURL + "/Content/back/images/mail_leftbg.gif") %>"><img src="<%=Url.Content

(kysec.CR.MyUrl.WebData.WEBURL + "/Content/back/images/buttom_left2.gif") %>" width="17" height="17" /></td>
      <td  valign="top" background="<%=Url.Content(kysec.CR.MyUrl.WebData.WEBURL + "/Content/back/images/buttom_bgs.gif") %>"><img src="<%=Url.Content

(kysec.CR.MyUrl.WebData.WEBURL + "/Content/back/images/buttom_bgs.gif") %>" width="17" height="17" /></td>
    <td background="<%=Url.Content(kysec.CR.MyUrl.WebData.WEBURL + "/Content/back/images/mail_rightbg.gif") %>"><img src="<%=Url.Content(kysec.CR.MyUrl.WebData.WEBURL + 

"/Content/back/images/buttom_right2.gif") %>" width="16" height="17" /></td>
  </tr>
</table>
    </div>
</body>
</html>
